package com.aizhixin.lab.course.template.repository;

import com.aizhixin.lab.course.template.entity.Template;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

public interface TemplateRepository extends JpaRepository<Template, Long> {
    Template findByIdAndDeleteFlag(Long id, Integer deleteFlag);
    List<Template> findByDeleteFlag(Integer deleteFlag);
    List<Template> findByDeleteFlagAndCreatedBy(Integer deleteFlag,Long created);
    Template findByIdAndIsPublishAndDeleteFlag(Long id, Boolean isPublish, Integer deleteFlag);
    Page<Template> findByTypeAndDeleteFlag(Pageable pageable, Integer type, Integer deleteFlag);
    Page<Template> findByTypeAndDeleteFlagAndCreatedBy(Pageable pageable, Integer type, Integer deleteFlag,Long createBy);
    Page<Template> findByTypeAndDeleteFlagAndIsPublish(Pageable pageable, Integer type, Integer deleteFlag, Boolean isPublish);
    Page<Template> findByTypeAndDeleteFlagAndIsPublishAndCreatedBy(Pageable pageable, Integer type, Integer deleteFlag, Boolean isPublish,Long createBy);
    Integer countByNameAndDeleteFlag(String name,Integer deleteFlag);
    Page<Template> findByIsPublishAndTypeAndDeleteFlag(Pageable pageable, Boolean isPublish, Integer type, Integer deleteFlag);
    Page<Template> findByIsPublishAndTypeAndDeleteFlagAndCreatedByIn(Pageable pageable, Boolean isPublish, Integer type, Integer deleteFlag, List<Long> createdBys);
    Page<Template> findByIsPublishAndTypeAndDeleteFlagAndNameLikeIgnoreCaseAndCreatedByIn(Pageable pageable, Boolean isPublish, Integer type, Integer deleteFlag, String name, List<Long> createdBys);
    Page<Template> findByIsPublishAndDeleteFlagAndCreatedByIn(Pageable pageable, Boolean isPublish, Integer deleteFlag, List<Long> createdBys);
    Page<Template> findByIsPublishAndDeleteFlagAndNameLikeIgnoreCaseAndCreatedByIn(Pageable pageable, Boolean isPublish, Integer deleteFlag, String name, List<Long> createdBys);









    Page<Template> findByTypeAndDeleteFlagAndNameLikeIgnoreCase(Pageable pageable, Integer type, Integer deleteFlag, String name);
    Page<Template> findByTypeAndDeleteFlagAndNameLikeIgnoreCaseAndCreatedBy(Pageable pageable, Integer type, Integer deleteFlag, String name,Long createBy);
    Page<Template> findByTypeAndDeleteFlagAndIsPublishAndNameLikeIgnoreCase(Pageable pageable, Integer type, Integer deleteFlag, Boolean isPublish, String name);
    Page<Template> findByTypeAndDeleteFlagAndIsPublishAndNameLikeIgnoreCaseAndCreatedBy(Pageable pageable, Integer type, Integer deleteFlag, Boolean isPublish, String name,Long createBy);
    Page<Template> findByIsPublishAndTypeAndDeleteFlagAndNameLikeIgnoreCase(Pageable pageable, Boolean isPublish, Integer type, Integer deleteFlag, String name);

    Page<Template> findByDeleteFlagAndNameLikeIgnoreCase(Pageable pageable, Integer deleteFlag, String name);
    Page<Template> findByDeleteFlagAndNameLikeIgnoreCaseAndCreatedBy(Pageable pageable, Integer deleteFlag, String name,Long createBy);
    Page<Template> findByDeleteFlagAndIsPublishAndNameLikeIgnoreCase(Pageable pageable, Integer deleteFlag, Boolean isPublish, String name);
    Page<Template> findByDeleteFlagAndIsPublishAndNameLikeIgnoreCaseAndCreatedBy(Pageable pageable, Integer deleteFlag, Boolean isPublish, String name,Long createBy);

    Page<Template> findByIsPublishAndDeleteFlagAndNameLikeIgnoreCase(Pageable pageable, Boolean isPublish, Integer deleteFlag, String name);

    Page<Template> findByDeleteFlag(Pageable pageable, Integer deleteFlag);
    Page<Template> findByDeleteFlagAndCreatedBy(Pageable pageable, Integer deleteFlag,Long createBy);
    Page<Template> findByDeleteFlagAndIsPublish(Pageable pageable, Integer deleteFlag, Boolean isPublish);
    Page<Template> findByDeleteFlagAndIsPublishAndCreatedBy(Pageable pageable, Integer deleteFlag, Boolean isPublish,Long createBy);

    Page<Template> findByIsPublishAndDeleteFlag(Pageable pageable, Boolean isPublish, Integer deleteFlag);
}
